package com.sinba.common.business.dao;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.sinba.common.business.entity.SharePriceTrendEntity;
import com.sinba.common.dao.BaseDAOImplHibernate;
import com.sinba.common.dto.PageDTO;
import com.sinba.common.util.StringUtils;

public class SharePriceTrendDAO extends BaseDAOImplHibernate<SharePriceTrendEntity> implements ISharePriceTrendDAO {

	public PageDTO findPager(SharePriceTrendEntity query, Integer start, Integer limit) {
		// TODO Auto-generated method stub
		final DetachedCriteria dc = DetachedCriteria.forClass(SharePriceTrendEntity.class);
		if(StringUtils.hasText(query.getTypes())){
			dc.add(Restrictions.eq("types", query.getTypes()));
		}
		dc.addOrder( Order.desc( "id" ) );
		return super.findPageByCriteria(dc,start,limit);
	}

}
